package net.oriol.shared.math;

import net.oriol.shared.math.Float4;

/**
 * Matrix44 class.
 * 
 * @author floh
 *
 */
public class Matrix44 {
	
	float r0x, r0y, r0z, r0w;
	float r1x, r1y, r1z, r1w;
	float r2x, r2y, r2z, r2w;
	float r3x, r3y, r3z, r3w;
	
	/**
	 * Default constructor
	 */
	Matrix44()
	{
		this.r0x = 1.0f; this.r0y = 0.0f; this.r0z = 0.0f; this.r0w = 0.0f;
		this.r1x = 0.0f; this.r1y = 1.0f; this.r1z = 0.0f; this.r1w = 0.0f;
		this.r2x = 0.0f; this.r2y = 0.0f; this.r2z = 1.0f; this.r2w = 0.0f;
		this.r3x = 0.0f; this.r3y = 0.0f; this.r3z = 0.0f; this.r3w = 1.0f;
	}
	
	/**
	 * Construct from row vectors.
	 * @param row0
	 * @param row1
	 * @param row2
	 * @param row3
	 */
	Matrix44(Float4 row0, Float4 row1, Float4 row2, Float4 row3)
	{
		this.r0x = row0.x; this.r0y = row0.y; this.r0z = row0.z; this.r0w = row0.w;
		this.r1x = row1.x; this.r1y = row1.y; this.r1z = row1.z; this.r1w = row1.w;
		this.r2x = row2.x; this.r2y = row2.y; this.r2z = row2.z; this.r2w = row2.w;
		this.r3x = row3.x; this.r3y = row3.y; this.r3z = row3.z; this.r3w = row3.w;
	}
	
	/**
	 * Construct from scalars.
	 * @param _r0x
	 * @param _r0y
	 * @param _r0z
	 * @param _r0w
	 * @param _r1x
	 * @param _r1y
	 * @param _r1z
	 * @param _r1w
	 * @param _r2x
	 * @param _r2y
	 * @param _r2z
	 * @param _r2w
	 * @param _r3x
	 * @param _r3y
	 * @param _r3z
	 * @param _r3w
	 */
	Matrix44(float _r0x, float _r0y, float _r0z, float _r0w,
			 float _r1x, float _r1y, float _r1z, float _r1w,
			 float _r2x, float _r2y, float _r2z, float _r2w,
			 float _r3x, float _r3y, float _r3z, float _r3w)
	{
		this.r0x = _r0x; this.r0y = _r0y; this.r0z = _r0z; this.r0w = _r0w;
		this.r1x = _r1x; this.r1y = _r1y; this.r1z = _r1z; this.r1w = _r1w;
		this.r2x = _r2x; this.r2y = _r2y; this.r2z = _r2z; this.r2w = _r2w;
		this.r3x = _r3x; this.r3y = _r3y; this.r3z = _r3z; this.r3w = _r3w;
	}
	
	/**
	 * Copy constructor.
	 * @param rhs
	 */
	Matrix44(Matrix44 rhs)
	{
		this.r0x = rhs.r0x; this.r0y = rhs.r0y; this.r0z = rhs.r0z; this.r0w = rhs.r0w;
		this.r1x = rhs.r1x; this.r1y = rhs.r1y; this.r1z = rhs.r1z; this.r1w = rhs.r1w;
		this.r2x = rhs.r2x; this.r2y = rhs.r2y; this.r2z = rhs.r2z; this.r2w = rhs.r2w;
		this.r3x = rhs.r3x; this.r3y = rhs.r3y; this.r3z = rhs.r3z; this.r3w = rhs.r3w;		
	}
}

